//
//  ToutiaoViewController.m
//  SinaNews
//
//  Created by qianfeng on 15-6-16.
//  Copyright (c) 2015年 耿宁. All rights reserved.
//

#import "ToutiaoViewController.h"
#import "NewsCell.h"
#import "NewsModel.h"
#import "ImageCell.h"
@interface ToutiaoViewController ()

@end

@implementation ToutiaoViewController

- (void)viewDidLoad {
    [super viewDidLoad];
      self.tableView.rowHeight=150;
    [self.tableView registerNib:[UINib nibWithNibName:@"NewsCell" bundle:nil] forCellReuseIdentifier:@"NewsCell"];
    [self.tableView registerNib:[UINib nibWithNibName:@"ImageCell" bundle:nil] forCellReuseIdentifier:@"ImageCell"];
    [self downloadData:kNewsUrl];
    
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    NewsCell *cell=[tableView dequeueReusableCellWithIdentifier:@"NewsCell" forIndexPath:indexPath];
    ImageCell *cell2=[tableView dequeueReusableCellWithIdentifier:@"ImageCell" forIndexPath:indexPath];
    
    //NSLog(@"%@",self.dataArr[indexPath.row]);
    NewsModel *model=self.dataArr[indexPath.row];
    if (model.pics.count==0) {
        [cell showDataWithModel:model];
        return cell;
    }else {
        [cell2 showDataWithModel:model];
    }
    return cell2;


}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    
}

@end
